<include file="Common/header" />
<!-- 顶部 -->     
<div id="middle">
    <include file="Common/menu" />
    <div class="right" id="mainFrame">
		<div class="right_cont">
			<ul class="breadcrumb">当前位置：
				<a href="javascript:void(0);">首页</a> <span class="divider">/</span>
				<a href="javascript:void(0);">门锁控制管理</a> <span class="divider">/</span>
				门锁钥匙远程控制
			</ul>
			<div class="title_right"><strong>远程控制</strong></div>
			<form action="" method="POST" id="addfrom">
				<div style="width: 900px; margin:auto">
					<table class="table table-bordered">
						<tr>
							<td width="20%" align="right" bgcolor="#f1f1f1">房间号：</td>
							<td>
								<input type="text" name="room_number" id="room_number" class="span1-3" value="" />
								<span class="usernameabel"></span>
							</td>
							
							<td width="20%" align="right" bgcolor="#f1f1f1">指令：</td>
							<td>
								<select id="cmd" name="cmd">
									<option value="002">发送身份证ID</option>
									<option value="003">发送IC卡ID</option>
									<option value="004">发送密码</option>
									<option value="005">取消身份证ID</option>
									<option value="006">取消IC卡ID</option>
									<option value="007">取消密码</option>
									<option value="008">删除所有用户</option>
								</select>
							</td>
						</tr>
						<tr>
							<td width="20%" align="right" bgcolor="#f1f1f1" class="remark">员工姓名：</td>
							<td colspan="3">
								<input type="text" name="remark" id="remark" class="span1-3" value="" />
								<span class="passwordabel"></span>
							</td>
						</tr>
						
						<tr>
							<td width="20%" align="right" bgcolor="#f1f1f1">启用时间：</td>
							<td>
								<input type="text" name="btime" id="btime" class="laydate-icon span1-3" value="" />
								<span class="nicknameabel"></span>
							</td>
							<td width="20%" align="right" bgcolor="#f1f1f1">结束时间：</td>
							<td>
								<input type="text" name="etime" id="etime" class="laydate-icon span1-3" value="" />
								<span class="nicknameabel"></span>
							</td>
						</tr>
					</table>
					
					<table  class="margin-bottom-20 table  no-border" >
						<tr>
							<td class="text-center">
								<input type="button" value="确定" class="btn btn-info roleSubmit" style="width:80px;" />
								<a href="cmdexcel.html"><input type="button" value="导出Excel" class="btn btn-success" style="width:80px;" /></a>
							</td>
						</tr>
					</table>
				</div>
			</form>
			
			<div class="title_right"><strong>后台操作记录</strong></div>
			<div id="ajaxDiv">
				<include file="Lockcmd/cmd_list" />
			</div>
		</div>     
    </div>
</div>
<script>
	$(document).ready(function(){
		$(".roleSubmit").on('click', function(){
			var data = {};
				data.cmd = $("#cmd").val();
				data.remark = $("#remark").val();
				data.btime = $("#btime").val();
				data.etime = $("#etime").val();
				data.room_number = $("#room_number").val();
			
			if(data.room_number == ""){
				alert("请输入房间号");
				return false;
			}
			
			$.post('cmd.html', data, function(result){
				alert(result);
				location.reload();
			},"JSON");
		});
		
		$(".btn-successsss").on('click', function(){
			var room_number = $("#room_number").val();
			if(room_number == ""){
				alert("请输入房间号");
				return false;
			}
			
			location.href = "cmdexcel.html"+ room_number;
		});
		
		$("#cmd").on('change', function(){
			var obj = $(this);
				cmd = obj.val();
			switch(cmd){
				case '002':
					$(".remark").html('员工姓名：');
				break;
				case '003':
					$(".remark").html('房卡号：');
				break;
				case '004':
					$(".remark").html('密&nbsp;&nbsp;码：');
				break;
				case '005':
					$(".remark").html('员工姓名：');
				break;
				case '006':
					$(".remark").html('房卡号：');
				break;
				case '007':
					$(".remark").html('密&nbsp;&nbsp;码：');
				break;
				case '008':
					$(".remark").html('房卡号：');
				break;
			}
		});
	});
</script>
<script>
!function(){
	laydate.skin('molv');
	laydate({elem: '#btime', format: "YYYY-MM-DD hh:mm:ss"});
	laydate({elem: '#etime', format: "YYYY-MM-DD hh:mm:ss"});
}();
</script>
<include file="Common/footer" />
